# 编译阶段
FROM golang:1.18.1-alpine3.15 AS buildStage
WORKDIR /go/src
# 将当前目录所有内容加入到 编译环境
ADD . /go/src
# 编译 并将输出名配置为 main
RUN cd /go/src && go build -o main

# 打包阶段
FROM alpine:latest
WORKDIR /app
EXPOSE 8080

COPY --from=buildStage /go/src/main /app/
ENTRYPOINT ./main